#This file is part of SECONDO.

#Copyright (C) 2004, University in Hagen, Department of Computer Science, 
#Database Systems for New Applications.

#SECONDO is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.

#SECONDO is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with SECONDO; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

########################################################################
#
# SECONDO makefile for Appoximation Algebra C++
#
########################################################################

# 30.11.2004, M. Spiekermann. Reorganization of the makefiles at the algbra
#             level. This is a documented makefile which should explain the
#             basic structure.

# include global definitions
include ../../makefile.env

# This is the only macro which must be changed in order to
# define a module name for an algebra. The rest of this makefile
# should work for nearly every algebra. 
MODNAME = RasterAlgebra

# Use the mace CCFLAGS to add special compiler flags if needed.
# In this case the defaults are sufficient
CCFLAGS = $(DEFAULTCCFLAGS) -I../Rectangle -I../Spatial -I./Assinatura/*.cpp -I./RTree/*.cpp -I./GeraAssinatura/*.cpp -I./gpc/*.cpp  -I./Assinatura/*.h -I./RTree/*.h -I./GeraAssinatura/*.h -I./gpc/*.h

# The next rule will create a ".o" file for every ".cpp" file and 
# creates a "lib$(MODNAME).a" file in the secondo/lib dir. Rules
# for creating ".dep" files and ".o" files are defined in makefile.env
.PHONY: all
all: $(OBJECTS) $(LIBOBJ) 

# DEP_FILES is a macro defined in makefile.env. It will contain
# a list of files which are generated by the compiler to
# detect dependencies to other code files.
include $(DEP_FILES)

# The rule below creates a library file. Maybe as shared or as static
# object. In case of a shared object all dependencies to other libraries
# must be defined. However, currently the command make shared=yes will 
# not work. But in principle every algebra implementor has to define dependencies
# to other libraries here, since the make procedure does not know how to do this
# automatically. 
$(LIBOBJ): $(OBJECTS)
ifeq ($(shared),yes)
# ... as shared object
	$(LD) $(LDFLAGS) ./Assinatura/*.cpp ./RTree/*.cpp -o $(LIBOBJ) $(LDOPT) $(OBJECTS) -L$(LIBDIR) -lStandardAlgebra -lSpatialAlgebra $(SDBLIB) $(TOOLLIB) $(DEFAULTLIB)
else
# ... as static library
	$(AR) -r $(LIBOBJ) $(OBJECTS)
endif

# remove all generated stuff
.PHONY: clean
clean:
	$(RM) $(DEP_FILES) $(OBJECTS) $(LIBOBJ)
